-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: move the pages to src/pages #154
Conversation
- Move the Elements page, the element page, Your gymnasts and the login page with their tests from src/components/ to src/pages/ (git mv) - Move the Calculator, About and not-found placeholders out of App.tsx - Import the pages from @/pages in App.tsx - Keep the page theme test checking the two moved pages - Describe src/pages, src/components, src/components/ui and src/lib in the README, and update the links in the docs Closes #97 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Move all 29 frontend tests with git mv into src/tests/, in the same folders as the code they test - Import what they test with the @/ alias instead of relative paths - Read the theme files from the new place in gymnastTheme.test.ts - Describe src/tests in the README, and update the links to the tests Part of #97 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a priority? can be there but noting it for the record
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be done in this issue, but makes sense so ill let i tbe
| @@ -231,6 +235,7 @@ describe('the components of the gymnasts and login pages', () => { | |||
|
|
|||
| it('looks at the components of both pages and not at their tests', () => { | |||
| expect(files.some((f) => f.endsWith('GymnastRow.tsx'))).toBe(true) | |||
| expect(files.some((f) => f.endsWith('YourGymnastsPage.tsx'))).toBe(true) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make sure you intended to make this change as this is a code change
|
maybe write a comment in AI usage about the old file paths and reasoning for changing so it is documented what we had first and what we now have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found no errors and the page works fine
Move the pages to
src/pages/, and the frontend tests tosrc/tests/Closes #97
The pages were in
src/components/, next to the components they use, so it was hard to see which files are routes and which are parts of pages. Now every route inApp.tsxhas one file insrc/pages/, andsrc/components/only holds the parts of the pages.What moved
src/components/elements/ElementsPage.tsxsrc/pages/ElementsPage.tsxsrc/components/elements/ElementDetailPage.tsxsrc/pages/ElementDetailPage.tsxsrc/components/gymnasts/YourGymnastsPage.tsxsrc/pages/YourGymnastsPage.tsxsrc/components/auth/LoginPage.tsxsrc/pages/LoginPage.tsxsrc/App.tsxsrc/pages/CalculatorPage.tsx,AboutPage.tsx,NotFoundPage.tsxThe files were moved with
git mv, so their history follows them (git log --follow). Their content is unchanged, apart from one import inLoginPage.tsx(shared/demo, one folder less). The components the pages use stay insrc/components/elements/,gymnasts/andauth/.Also in this PR: the frontend tests in
src/tests/This was not part of the issue, but it fits with it: the issue makes
src/pages/andsrc/components/show what the app is made of, and the tests next to the code made those folders harder to read in the same way.git mvintosrc/tests/, in the same folders as the code they test (src/tests/pages/,src/tests/components/elements/,src/tests/lib/apollo/...).src/tests/already had the shared test helpers (setupTests.ts,apollo.ts,elementRows.ts).@/alias instead of relative paths, so a test does not depend on where it is.backend/src/. The backend is its own package with Node's relative imports and small folders, where that is the usual layout. The README explains the difference in a new section, "Where the tests are".Other changes
src/App.tsx: imports every page from@/pages/…, and no longer defines the placeholder pages itself.gymnastTheme.test.ts: this test reads the files of the gymnasts and login pages by folder. After the move it would have stopped checking the two pages without failing, so they are now listed explicitly, and the test checks that both are included. Its paths also start from its new place insrc/tests/styles/.src/pages/(one file per route),src/components/(parts of pages),src/components/ui/(the shadcn/ui components and a few small shared components),src/lib/,src/tests/andbackend/src/. The new section "Where the tests are" says where the frontend, backend and end-to-end tests are, and why. The links to the moved files are updated in the README,docs/ACCESSIBILITY.md,docs/AUTHENTICATION.mdanddocs/SUSTAINABILITY.md.docs/AI_USAGE.md: a new entry.Not in this PR
The issue suggests moving our own components out of
src/components/ui/(DifficultyBadge,ElementValueBadge,ElementVariants), so that folder only holds shadcn/ui components. That can be a separate PR.Testing
tsc -b, ESLint andnpm run buildpass.src/tests/, and no frontend test is left outside it. No backend files are changed.App.tsxandYourGymnastsPage.tsx) are left as they are, so the PR only moves files and does not reformat them.🤖 Generated with Claude Code